package dom.domain;

import java.util.ArrayList;
import java.util.Map;

/**
 * Expert entity. @author MyEclipse Persistence Tools
 */

public class Expert implements java.io.Serializable {

	// Fields

	private String expertId;//add
	private String expertName;//add
	private String email;//add
	private String password;
	private Integer epId;
	private String userSubType;
	private Integer epClassId;

	// Constructors

	/** default constructor */
	public Expert() {
	}

	public Integer getEpClassId() {
		return epClassId;
	}

	public void setEpClassId(Integer epClassId) {
		this.epClassId = epClassId;
	}

	/** minimal constructor */
	public Expert(String expertId, String expertName, String email) {
		this.expertId = expertId;
		this.expertName = expertName;
		this.email = email;
	}

	/** full constructor */
	public Expert(String expertId, String expertName, String email,
			String password, Integer epId, String userSubType) {
		this.expertId = expertId;
		this.expertName = expertName;
		this.email = email;
		this.password = password;
		this.epId = epId;
		this.userSubType = userSubType;
	}

	// Property accessors

	public String getExpertId() {
		return this.expertId;
	}

	public void setExpertId(String expertId) {
		this.expertId = expertId;
	}

	public String getExpertName() {
		return this.expertName;
	}

	public void setExpertName(String expertName) {
		this.expertName = expertName;
	}

	public String getEmail() {
		return this.email;
	}

	public void setEmail(String email) {
		this.email = email;
	}

	public String getPassword() {
		return this.password;
	}

	public void setPassword(String password) {
		this.password = password;
	}

	public Integer getEpId() {
		return this.epId;
	}

	public void setEpId(Integer epId) {
		this.epId = epId;
	}

	public String getUserSubType() {
		return this.userSubType;
	}

	public void setUserSubType(String userSubType) {
		this.userSubType = userSubType;
	}

	@Override
	public String toString() {
		return "{expertId:'" + expertId + "', expertName:'" + expertName
				+ "', email:'" + email + "', password:'" + password
				+ "', epId:'" + epId + "', userSubType:'" + userSubType
				+ "', epClassId:'" + epClassId + "'}";
	}

	// Property accessors
	public void setInfo(ArrayList<String> list, Map<String, String> expertInfo) {
		// String[] title = Info.split("#");
		// String[] addInfo = expertInfo.split("#");
		for (int i = 0; i < list.size(); i++) {

			if (list.get(i).equals("expertName")) {
				this.setExpertName(expertInfo.get(list.get(i)));
				;
			}
			if (list.get(i).equals("expertId")) {
				this.setExpertId(expertInfo.get(list.get(i)));
			}
			if (list.get(i).equals("email")) {
				this.setEmail(expertInfo.get(list.get(i)));
			}
			if (list.get(i).equals("password")) {
				this.setPassword(expertInfo.get(list.get(i)));
			}
			if (list.get(i).equals("epId")) {
				this.setEpId(Integer.parseInt(expertInfo.get(list.get(i))));
			}
			if (list.get(i).equals("userSubType")) {
				this.setUserSubType(expertInfo.get(list.get(i)));
			}
			if (list.get(i).equals("epClassId")) {
				this.setEpClassId(Integer.parseInt(expertInfo.get(list.get(i))));
			}
		}
	}

	public ArrayList<String> getInfo(String Info) {
		String[] title = Info.split("#");
		ArrayList<String> list = new ArrayList<String>();
		for (int i = 0; i < title.length; i++) {
			if (title[i].equals("expertName")) {
				list.add(this.getExpertName());
			}
			if (title[i].equals("expertId")) {
				list.add(this.getExpertId());
			}
			if (title[i].equals("email")) {
				list.add(this.getEmail());
			}
			if (title[i].equals("password")) {
				list.add(this.getPassword());
			}
			if (title[i].equals("epId")) {
				list.add(Integer.toString(this.getEpId()));
			}
			if (title[i].equals("userSubType")) {
				list.add(this.getUserSubType());
			}
			if (title[i].equals("epClassId")) {
				list.add(Integer.toString(this.getEpClassId()));
			}
		}
		return list;
	}

}